package com.cn.service;

import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class Test {

    public static void main(String[] args) {
        System.out.println("redis 测试");
        Jedis jedis=new Jedis("159.65.157.93",6379);
        System.out.println("ping 一下redis服务"+jedis.ping());

        //设置 k1  键的字符
       /* jedis.set("k1","我是第一个redis");
        //取出k1 的值
        String k1=jedis.get("k1");
        System.out.println(k1);
        //列出所有的key   * 代表所有
        Set<String> set=jedis.keys("*");
        Iterator<String> iterator=set.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        //检查某个key 是否存在
        boolean flag=jedis.exists("k1");
        System.out.println(flag);
        List<Stu> list =new ArrayList<Stu>();
        Stu s=new Stu("女","男");*/
    }
}
